|
A programming language uses an evaluation strategy to determine when to evaluate the argument(s) of a function call (for function, also read: operation, method, or relation) and what kind of value to pass to the function. For example, call-by-value/pass-by-reference specifies that a function application evaluates the argument before it proceeds to the evaluation of the function's body and that it passes two capabilities to the function, namely, the ability to look up the current value of the argument and to modify it via an assignment statement.〔Essentials of Programming Languages by Daniel P. Friedman and Mitchell Wand, MIT Press 1989--2006〕 The notion of reduction strategy in lambda calculus is similar but distinct. In practical terms, many modern programming languages have converged on a call-by-value, pass-by-reference strategy for function calls (C#, Java). Some older languages, especially unsafe languages such as C++, combine several notions of parameter passing. Historically, call-by-value and call-by-name date back to Algol 60, a language designed in the late 1950s. Call-by-reference is used by PL/I and some Fortran systems.〔Some Fortran systems use call by copy-restore.〕 Purely functional languages like Haskell, as well as non-purely functional languages like R, use by-need. The evaluation strategy is specified by the programming language definition, and is not a function of any specific implementation. ==Strict evaluation== (詳細はfunction are always evaluated completely before the function is applied. Under Church encoding, eager evaluation of operators maps to strict evaluation of functions; for this reason, strict evaluation is sometimes called "eager". Most existing programming languages use strict evaluation for functions. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Evaluation strategy」の詳細全文を読む スポンサード リンク
|